package com.zmytest;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;
import org.springframework.web.servlet.handler.MappedInterceptor;

/**
 * Created on 2019/1/28.
 *
 * @author zhangmingyu
 */
@Configuration
public class WebConfig extends WebMvcConfigurerAdapter {

    @Bean
    public MappedInterceptor getMappedInterceptor(){
        return new MappedInterceptor(new String[]{"/img/**"},new MyInterceptor());
    }

//    @Override
//    public void addInterceptors(InterceptorRegistry registry) {
//        registry.addInterceptor(new MyInterceptor()).addPathPatterns("/img/**");
//        super.addInterceptors(registry);
//    }
}
